/**
 * fileName:  AccountImpl.java
 * author:  Lei
 * Company:  Cloudland Studio
 * Createdate:  2014-2-22 下午4:54:07
 *
 * All rights Reserved, Designed By cloudland Copyright(C) 2010-2020
 *   
 * Modification  History:
 *     Date           Author        Version        
 * -------------------------------------------
 * 2014-2-22          Lei            1.0        
 *
 * Why & What is modified:
 * 1.0: 文件创建
 */
package org.cloudland.commercial.uphold.handler.support;

import org.cloudland.commercial.uphold.handler.Account;
import org.cloudland.commercial.uphold.handler.Authorize;
import org.cloudland.commercial.uphold.store.IPersistence;
import org.cloudland.commercial.uphold.store.entity.AccountEntity;

 /**
 * <pre> 
 * TODO 请充分描述该类提供的作用, 或与其他类会有关联的使用。
 * 使用 java.lang.Object#toString(), 或者 {@link java.lang.Character Character} 等标签
 * </pre>
 * @ClassName  AccountImpl
 * @author  Lei
 * @version  %I%, %G%
 * @see  
 * @since   JDK1.6
 *
 */
public class AccountImpl implements Account {
	
	private AccountEntity entity = null;

	private IPersistence<AccountEntity> persist = null;
	
	public AccountImpl(AccountEntity entity, IPersistence<AccountEntity> persist) {
		this.entity = entity;
		this.persist = persist;
	}
	
	/**
	 * @return
	 */
	public String id() {
		return entity.getId();
	}

	/**
	 * @param accountName
	 */
	public void setName(String accountName) {
		this.entity.setName(accountName);
	}

	/**
	 * @return
	 */
	public String getName() {
		return this.entity.getName();
	}

	/**
	 * @param accountPassword
	 */
	public void setPassword(String accountPassword) {
		this.entity.setPasswd(accountPassword);
	}

	/**
	 * @return
	 */
	public String getPassword() {
		return this.entity.getPasswd();
	}
	
	/**
	 * @return
	 */
	public Authorize getAuthorize() {
		return null;
	}
	
	/**
	 * @param authorizeId
	 */
	public void setAuthorize(String authorizeId) {
	
	}

	/**
	 * 
	 */
	public void submit() {
		
		persist.save(this.entity);
		
	}
	
	/**
	 * @return
	 */
	@Override
	public String toString() {
		return this.entity.toString();
	}

}
